package com.zdd.chap2.vo;

import jdk.jfr.DataAmount;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultVo <T>{
    private String code;//响应状态码
    private String errorMsg;//用于封装异常信息，正常返回一般为null
    private Boolean result;//表示执行成功还是失败
    private T data;//封装返回数据

    public static<T> ResultVo<T> success(String mess,Boolean result,T data){
        return new ResultVo<T>("2000",mess,result,data);
    }

    public static<T> ResultVo<T> error(String mess,Boolean result){
        return new ResultVo<T>("5000",mess,result,null);
    }
}
